//
//  ZLAlertConfig.m
//  ZLAlert-OC
//
//  Created by 科大 on 2024/1/2.
//

#import "ZLAlertConfig.h"

@implementation ZLAlertItemConfig
- (instancetype)init {
    self = [super init];
    if (self) {
        _font = [UIFont systemFontOfSize:14];
        _color = [UIColor blackColor];
        _backgroundColor = [UIColor clearColor];
        _alignment = NSTextAlignmentCenter;
        _insets = UIEdgeInsetsZero;
        _height = 40;
        _cornerRadius = 0;
        _borderWidth = 0;
        _borderColor = [UIColor clearColor];
    }
    return self;
}
@end

@implementation ZLAlertConfig

static ZLAlertConfig *_shared;

+ (ZLAlertConfig *)shared {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        _shared = [[self alloc] init];
    });
    return _shared;
}

- (instancetype)init {
    self = [super init];
    if (self) {
        _backgroundEnable = NO;
        _titleConfig = [[ZLAlertItemConfig alloc] init];
        _titleConfig.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
        _titleConfig.insets = UIEdgeInsetsMake(20, 0, 20, 0);
        
        _contentConfig = [[ZLAlertItemConfig alloc] init];
        _contentConfig.font = [UIFont systemFontOfSize:14];
        _contentConfig.color = [UIColor colorWithRed:153/255.0 green:153/255.0 blue:153/255.0 alpha:1.0];
        _contentConfig.insets = UIEdgeInsetsMake(0, 23, 20, 23);
        
        _submitButtonConfig = [[ZLAlertItemConfig alloc] init];
        _submitButtonConfig.color = [UIColor blackColor];
        _submitButtonConfig.font = [UIFont systemFontOfSize:14 weight:500];
        
        _cancelButtonConfig = [[ZLAlertItemConfig alloc] init];
        _cancelButtonConfig.color = [UIColor colorWithRed:174/255.0 green:178/255.0 blue:186/255.0 alpha:1.0];
        
        _lineConfig = [[ZLAlertItemConfig alloc] init];
        _lineConfig.backgroundColor = [UIColor colorWithRed:153/255.0 green:153/255.0 blue:153/255.0 alpha:0.1];
        _lineConfig.height = 0.5;
        
        _inputConfig = [[ZLAlertItemConfig alloc] init];
        _inputConfig.backgroundColor = [UIColor colorWithRed:249/255.0 green:249/255.0 blue:249/255.0 alpha:1.0];
        _inputConfig.insets = UIEdgeInsetsMake(0, 23, 0, 23);
        _inputConfig.cornerRadius = 5;
        
        _imageConfig = [[ZLAlertItemConfig alloc] init];
        _imageConfig.backgroundColor = [UIColor clearColor];
    }
    return self;
}

@end
